from torch.nn import functional as F
"""1. 定义权重"""
w = torch.rand(16, 3, 5, 5)  # 16种3通道的5乘5卷积核
b = torch.rand(16) # 和卷积核种类数保持一致（不同通道共用一个bias)
"""2. 定义输入样本"""
x = torch.randn(1, 3, 28, 28)  # 1张3通道的28乘28的图像
"""3. 2D卷积得到输出"""
out = F.conv2d(x, w, b, stride=1, padding=1)  
# 步长为1,外加1圈padding
print(out.shape)
